<ui:composition template="/resources/templates/table.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets">

    <ui:define name="table-header">
        <h:outputText value="#{msgs['table.users']}" styleClass="table_name"/>
    </ui:define>

    <ui:define name="button-menu-top">
        <div>
            <input type="button" title="#{msgs['add']}" value="#{msgs['add']}" class="margin2ptb"/>
            <input type="button" title="#{msgs['edit']}" value="#{msgs['edit']}" class="margin2ptb"/>
            <input type="button" title="#{msgs['delete']}" value="#{msgs['delete']}" class="margin2ptb"/>
        </div>
    </ui:define>

    <ui:define name="table-content">
        <div class="table_wrapper">
            <div>
                <div>
                    <div style="width: 100%;">
                        <table border="0" cellspacing="0" cellpadding="0" class="table_data">
                            <thead>
                            <tr>
                                <th class="th_data_first"></th>
                                <th class="th_data">#{msgs['login']}</th>
                                <th class="th_data">#{msgs['password']}</th>
                                <th class="th_data">#{msgs['firstName']}</th>
                                <th class="th_data">#{msgs['lastName']}</th>
                                <th class="th_data">#{msgs['enabled']}</th>
                                <th class="th_data">#{msgs['accountNonExpired']}</th>
                                <th class="th_data">#{msgs['credentialsNonExpired']}</th>
                                <th class="th_data">#{msgs['accountNonLocked']}</th>
                                <th class="th_data">#{msgs['roles']}</th>
                                <th class="th_data">#{msgs['lastActivity']}</th>
                            </tr>
                            </thead>
                            <ui:repeat value="#{usersTableBean.pagebleUsers}" var="user"
                                       varStatus="userindex">
                                <tr class="#{userindex.even ? 'even' : 'odd'}">
                                    <td class="td_data_first">#{user.id}</td>
                                    <td class="td_data">#{user.login}</td>
                                    <td class="td_data">#{user.password}</td>
                                    <td class="td_data">#{user.firstName}</td>
                                    <td class="td_data">#{user.lastName}</td>
                                    <td class="td_data">#{msgs[user.enabled]}</td>
                                    <td class="td_data">#{msgs[user.accountNonExpired]}</td>
                                    <td class="td_data">#{msgs[user.credentialsNonExpired]}</td>
                                    <td class="td_data">#{msgs[user.accountNonLocked]}</td>
                                    <td class="td_data pre">
                                        <h:outputText value="#{user.rolesForView}"/>
                                    </td>
                                    <td class="td_data">
                                        <h:outputText value="#{user.lastActivity}">
                                            <f:convertDateTime type="both" dateStyle="full" timeStyle="medium"
                                                               timeZone="Europe/Moscow"/>
                                        </h:outputText>
                                    </td>
                                </tr>
                            </ui:repeat>
                        </table>
                    </div>
                </div>
            </div>
            <ui:include src="/resources/includes/pagination.xhtml">
                <ui:param name="paginationBean" value="#{usersTableBean}"/>
            </ui:include>
        </div>
    </ui:define>

    <ui:define name="button-menu-bottom">
        <div>
            <input type="button" title="#{msgs['add']}" value="#{msgs['add']}" class="margin2ptb"/>
            <input type="button" title="#{msgs['edit']}" value="#{msgs['edit']}" class="margin2ptb"/>
            <input type="button" title="#{msgs['delete']}" value="#{msgs['delete']}" class="margin2ptb"/>
        </div>
    </ui:define>

</ui:composition>